

<div class="page-content">
	<!-- BEGIN PAGE HEADER-->
	<div class="row">
		<div class="col-md-12">
			<!-- BEGIN PAGE TITLE & BREADCRUMB-->
			<h3 class="page-title">
			Menu
			</h3>
			<ul class="page-breadcrumb breadcrumb">
				<li>
					<i class="fa fa-home"></i>
					<a href="<?php echo $this->Admin->admin_url() ?>">
						Home
					</a>
					<i class="fa fa-angle-right"></i>
				</li>
				<li>
					<a href="javascript:void(0)">
						Menu
					</a>
				</li>

			</ul>
			<!-- END PAGE TITLE & BREADCRUMB-->
		</div>
	</div>
	<!-- END PAGE HEADER-->
	<!-- BEGIN PAGE CONTENT-->
	<div class="row">
		<div class="col-md-12">
			<!-- BEGIN EXAMPLE TABLE PORTLET-->
			<div class="portlet box light-grey">
				<div class="portlet-title">
					<div class="caption">
						<i class="fa fa-globe"></i>Managed table
					</div>
				</div>
				<div class="portlet-body">
                    <?php echo $this->Session->flash(); ?>
					<div class="table-toolbar">
						<div class="btn-group">
							<a href="<?php echo $this->Admin->admin_url() ?>menu/add/<?php echo $parent_id ?>" class="btn green">
							Add_new <i class="fa fa-plus"></i>
							</a>
						</div>
                        <div class="col-md-4" style="float:right; padding-right:0px">
                        <?php
                            echo $this->Form->select('parent_menu', $parent_menu, 
                                    array(
                                        'class' => 'form-control',
                                        'empty' => 'Parent menu',
                                        'id' => 'parent_menu',
                                        'default' => $parent_id
                                    )
                            );
                        ?>
                        </div>
					</div>
					<table class="table table-striped table-bordered table-hover" id="table_menu">
					<thead>
					<tr>
						<th width="5%" class="align_center">
							nu
						</th>
						<th width="40%">
							 Menu name
						</th>
						<th width="10%" class="align_center">
							 Sort order
						</th>
						<th width="15%" class="align_center">
							 Status
						</th>
						<th width="15%" class="align_center">
							 Image
						</th>
						<th width="15%" class="align_center">
							 Actions
						</th>
					</tr>
					</thead>
					<tbody>
                        <?php
                            $i = 1;
                            foreach($list_menu as $menu)
                            {
                                
                                if(isset($menu['level']))
                                {
                                    $span = "";
                                    $level = $menu['level'];
                                    for($j = 0; $j < $level; $j++)
                                        $span .= '--&nbsp&nbsp';
                                }
                                else
                                {
                                    $span = " ";
                                }
                        ?>
    					<tr class="odd gradeX">
    						<td class="align_center">
    							<?php echo $i++ ?>
    						</td>
    						<td>
                                <?php echo $span != "" ? $span.$menu['title'] : "<strong style='color:#428bca'>{$menu['title']}</strong>"; ?>
    						</td>
    						<td class="align_center">
    							<?php echo $menu['sort_order'] ?>
    						</td>
    						<td class="align_center">
    							 <div class="btn-group-xs change-status">
                                    <?php
                                        if($menu['status'] == 1)
                                        {
                                    ?>
							            <button menu_id="<?php echo $menu['menu_id'] ?>" class="change_status_menu btn green" type="button">Enable</button>
                                    <?php
                                        }
                                        else
                                        {
                                    ?>
                                        <button menu_id="<?php echo $menu['menu_id'] ?>"  class="change_status_menu btn red" type="button">Disable</button>
                                    <?php
                                        }
                                    ?>
								</div>
    						</td>
    						<td class="align_center">
                                <?php
                                    $name_image = 'images/no-image.jpg';
                                    $name_image = $menu['image'] != "" ? $menu['image'] : $name_image;
                                ?>
    							 <img class="img_small" src="<?php echo $this->webroot ?><?php echo $name_image ?>" alt="IMG" />
    						</td>
    						<td class="align_center">
    							<div class=" btn-group-xs">
                                    <a class="btn blue" href="<?php echo $this->Admin->admin_url() ?>menu/edit/<?php echo $menu['menu_id'] ?>/<?php echo $parent_id ?>">Edit</a>
                                    <a href="javascript:void(0)" class="btn red config delete_menu" menu_id="<?php echo $menu['menu_id'] ?>">Delete</a>
								</div>
    						</td>
    					</tr>
                        <?php
                            }
                        ?>
					</tbody>
					</table>
				</div>
			</div>
			<!-- END EXAMPLE TABLE PORTLET-->
		</div>
	</div>
	<!-- END PAGE CONTENT-->
</div>